package com.jshoperxms.controller.api.langdumatch;

import com.jshoperxms.Response;
import com.jshoperxms.controller.utils.statickey.TagWords;
import com.jshoperxms.controller.utils.statickey.WarnWrods;
import com.jshoperxms.entity.YdAncientMatchRdT;
import com.jshoperxms.service.YdAncientMatchRdTService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by sdywcd on 2018/12/17.
 * Des:
 */
@RestController
@RequestMapping("/api/match/ancient")
public class YdAncientMatchRdTController {

    @Resource
    private YdAncientMatchRdTService ydAncientMatchRdTService;

    /**
     * 查询比赛结果信息
     * @param rq
     * @return
     */
    @RequestMapping(value="/findAncientMatchInfo",method= RequestMethod.POST)
    public ResponseEntity findAncientMatchInfo(@RequestBody YdAncientMatchRdT rq){
        Map<String,Object> responsedata=new HashMap<>();
        if(StringUtils.isNotBlank(rq.getId())){
            YdAncientMatchRdT bean=this.ydAncientMatchRdTService.findByPK(YdAncientMatchRdT.class,rq.getId());
            if(bean!=null){
                responsedata.put(TagWords.BEAN,bean);
                responsedata.put(TagWords.SUCCESS,true);
            }else{
                responsedata.put(TagWords.SUCCESS,false);
                responsedata.put(TagWords.MSG,WarnWrods.EMPTY_RECORD);
            }
        }else{
            responsedata.put(TagWords.SUCCESS,false);
            responsedata.put(TagWords.MSG,WarnWrods.ERROR_PARAMS);
        }
        return Response.success(responsedata);
    }

}

